import 'dart:ui' as ui;

import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_ncsjqz_getx/testPage.dart';
import 'package:get/get.dart';

import 'util/logger_util.dart';

/// 测试用例
void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    final botToastBuilder = BotToastInit();
    return GetMaterialApp(
      title: "测试用例",
      builder: (context, child) => botToastBuilder(context, child),
      //当前的语言
      localeListResolutionCallback: (locales, supportedLocales) =>
          logger('APP：$locales 设备：${ui.window.locale}', tag: "语言环境"),
      // 路由回调 可用于管理路由
      routingCallback: (call) => logger('${call}', tag: "routingCallback"),
      logWriterCallback: localLogWriter,
      home: TestPage(),
    );
  }

  // Get的日志信息
  void localLogWriter(String text, {bool isError = false}) =>
      logger(text, tag: "Getx Print");

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }
}
